$(document).ready(function(){
    $(".datagrid-pager.pagination").remove();//隐藏分页工具栏
    //隐藏更多问题件按钮
    $("#moreProblemList").hide();

    $("#moreProblemList").click(function () {
        openTabCrossDomainIcsSimple("csProblemOrder_dealtView","待办问题件工单",'/cs/CsProblemOrder/dealtView.do',true,0,portal_global_systemCode,true);
    });
    $("#moreCusterList").click(function () {
        openTabCrossDomainIcsSimple("csWoCustSer_dealtView_all","待办客服服务类工单",'/cs/CsWoCustSer/dealtView/all.do',true,0,portal_global_systemCode,true);
    });
    $('#tt').tabs({
        onSelect:function (title,index) {
            if(index===0){
                $("#moreProblemList").hide();
                $("#moreCusterList").show();
            }
            if(index==1){
                $("#moreCusterList").hide();
                $("#moreProblemList").show();
            }
        },
    });
    var url = G_CTX_PATH+"/dictData/findByTypesCodes.do";
    initDictDatas("PRCESS_PRIORITY_PROCESSING,WO_SOURCE,CUST_SER_STATUS,PROBLEM_STATUS",{url:url});
});
//客户服务问题操作列
function formatterdeal(value,rec,index){
    var ret="";
    if(rec.status=="0" || rec.status=="1" || rec.status=="2" || rec.status=="3" || rec.status=="4" ){//待处理
        ret='<a class="icon-line iconfont uce-edit" title="处理"  onclick="dealCsWoCustSer(\''+index+'\')" href="javascript:void(0)"></a>'
    }
    ret+='<a class=\"icon-line iconfont uce-see-details\" title=\"流程追踪\"  onclick=\"HgUtil.processTraceView(\''+rec.processInstanceId+'\')\" href=\"javascript:void(0)\"></a>';
    //查看图标待替换2018-06-04
    // ret+='<a class=\"tree-icon tree-file\" title=\"查看\"  onclick=\"viewCsWoCustSer(\''+index+'\')" href=\"javascript:void(0)\"></a>';
    return ret;
}
//问题件问题操作列
function formatterProblemDeal(value,rec,index) {
    if(value){
        return value;
    }
    var ret =  '<a class="icon-line iconfont uce-edit" title="处理"  onclick="complete(\''+rec.idStr+'\',\''+ rec.code +'\',\'' + rec.taskId +'\', 2)" href="javascript:void(0)"></a>';
    ret=ret+'<a class="icon-line iconfont uce-see-details" title="流程追踪"  onclick="HgUtil.processTraceView(\''+rec.processInstanceId+'\')" href="javascript:void(0)"></a>';
    return ret;
}
//查看客服
function viewCsWoCustSer(index){
    var rows = $("#acceptlist").datagrid("getData").rows;
    var row = rows[index];
    var id =row.idStr;
    var woCode =row.woCode;
    openTabCrossDomainIcsSimple("csWoCustSer_detail","客服服务类工单详情","/cs/CsWoCustSer/detail/" + id + "/view/"+woCode+"/.do",true,0,portal_global_systemCode,false);
}
//处理客服
function dealCsWoCustSer(index){
    var rows = $("#acceptlist").datagrid("getData").rows;
    var row = rows[index];
    var id =row.idStr;
    var woCode =row.woCode;
    var taskId =row.taskId;
    openTabCrossDomainIcsSimple("csWoCustSer_detail","处理客服服务类工单","/cs/CsWoCustSer/detail/" + id + "/noview/"+woCode+"/1/"+taskId+".do",true,0,portal_global_systemCode,false);
}
//临时完成事件
function complete(id, code, taskId, status) {
    openTabCrossDomainIcsSimple("csProblemOrder_handle","问题件工单处理",'/cs/CsProblemOrder/handle/' + id + '/' + code +'/' + taskId +'/' + status + '.do',true,0,portal_global_systemCode,true);
}
